function httpGETArray(url, afterSuccess, afterStatus, afterError) {
	console.log("httpGETArray " + url);
	var xmlHttpRequest = new XMLHttpRequest();
	xmlHttpRequest.responseType = 'arraybuffer';
	xmlHttpRequest.open('GET', url, true);
	xmlHttpRequest.onload = function () {
		var status = xmlHttpRequest.status;
		if (status == 200) {
			var arrayBuffer = xmlHttpRequest.response;
			afterSuccess(arrayBuffer);
		} else {
			afterStatus(xmlHttpRequest);
		}
	};
	xmlHttpRequest.onerror = function (xmlHttpRequestProgressEvent) {
		afterError(xmlHttpRequestProgressEvent);
	};
	xmlHttpRequest.send();
}
function httpGETText(url, afterSuccess, afterStatus, afterError) {
	console.log("httpGETText " + url);
	var xmlHttpRequest = new XMLHttpRequest();
	xmlHttpRequest.open('GET', url, true);
	xmlHttpRequest.onload = function () {
		var status = xmlHttpRequest.status;
		if (status == 200) {
			var text = xmlHttpRequest.response;
			afterSuccess(text);
		} else {
			afterStatus(xmlHttpRequest);
		}
	};
	xmlHttpRequest.onerror = function (xmlHttpRequestProgressEvent) {
		afterError(xmlHttpRequestProgressEvent);
	};
	xmlHttpRequest.send();
}
function httpPOSTText(data, url, afterSuccess, afterStatus, afterError) { //"lorem=ipsum&name=binny"
	console.log("httpPOSTText " + url);
	var xmlHttpRequest = new XMLHttpRequest();
	xmlHttpRequest.open('POST', url, true);
	me.xmlHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	var arrayBuffer = new ArrayBuffer(data.length);
	var uint8Array = new Uint8Array(arrayBuffer, 0);
	for (var i = 0; i < data.length; i++) {
		uint8Array[i] = (data.charCodeAt(i) & 0xff);
	}
	xmlHttpRequest.onload = function () {
		var status = xmlHttpRequest.status;
		if (status == 200) {
			var text = xmlHttpRequest.response;
			afterSuccess(text);
		} else {
			afterStatus(xmlHttpRequest);
		}
	};
	xmlHttpRequest.onerror = function (xmlHttpRequestProgressEvent) {
		afterError(xmlHttpRequestProgressEvent);
	};
	me.xmlHttpRequest.send(uint8Array);
}
